const express = require('express')
const app = express()

const middleWares = [
  (req, res, next) => {
    // res.send('hello')
    console.log(1);
    next()
  }, (req, res, next) => {
    console.log(2);
    // res.send('hello 2')
    next()
  }, (req, res, next) => {
    console.log(3);
    // res.send('hello 3')
    next()
  }
]

app.use('/', middleWares)

app.use('/ajax', (req, res) => {
  console.log(4);
  res.send('hello ajax')
})

app.use('/api', (req, res) => {
  console.log(5);
  res.send('hello api')
})

app.listen(3000, () => {
  console.log('localhost:3000');
})
